/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.iti.jets.gpts.service;

import com.iti.jets.gpts.dto.assist.Business;
//import com.iti.jets.gpts.dto.assist.RouteResult;
import com.iti.jets.gpts.pojo.Point;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author mustafajnr
 */
@Path("/route-search")
public class RouteSearchService {
    SessionFactory sessionFactory = new Configuration().configure("com/iti/jets/gpts/config/hibernate.cfg.xml").buildSessionFactory();
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public String search(
            @QueryParam("p1") Integer p1,
            @QueryParam("p2") Integer p2,
            @QueryParam("nos") Integer numberOfServices
    ){
        Point point1 = Business.getPoint(p1);
        Point point2 = Business.getPoint(p2);
        return Business.routeSearch(point1, point2, numberOfServices);
//        return "[{landmarks: [\"Tenth District, Nasr City\","
//                + "\"Al-Hijaz Square, Heliopolis\"],"
//                + "path: [1,2,3,4]},"
//                + "{landmarks: [\"Eighth District, Nasr City\","
//                + "\"Al-Nozha Street, Heliopolis\"],"
//                + "path: [1,2,3,4]}]";
    }
}
